<template>
  <div style="padding: 20px">
    <!--    <div @click="closePage"-->
    <!--         style="border: 1px solid #2C8DEB;text-align: center;color: #2C8DEB;-->
    <!--      border-radius: 5px;padding: 10px;width: 100px;font-size: 16px;cursor: pointer;">-->
    <!--      返回-->
    <!--    </div>-->
    <el-button type="primary" size="mini" style="width: 60px" @click="closePage">返回</el-button>
    <div style="text-align: center;">

      <div style="font-size: 30px;font-weight: 400;color: #333333;line-height: 54px;">
        {{ notifyDetail.title }}
      </div>

      <div
        style="color: #999999;font-size: 16px;margin-top: 20px;">
        回复日期：{{ notifyDetail.answerTime }}
      </div>
      <div style="margin-top:10px;border-bottom:1px solid rgba(215,215,215,0.63)"></div>
    </div>

    <div class="ql-editor" style="margin-left: 50px">
      <div v-html="notifyDetail.answerContent">
      </div>
      <div v-if="notifyDetail.answerFileUrl"
           style="display: flex;align-items: center;margin-top: 10px">
        下载：
        <div
          style="background-color: #E8F3FE;color: #1E8BFC;padding: 5px 15px;border-radius: 4px;font-size: 14px;cursor: pointer"
          @click="handleDownload">
          附件
        </div>
      </div>
    </div>

  </div>
</template>

<script>

export default {
  mounted() {
    console.log(this.$route.query.notify)
    this.notifyDetail = this.$route.query.notify
  },
  data() {
    return {
      notifyDetail: {}
    }
  },
  methods: {
    handleDownload() {
      // var name = row.fileName;
      let name = "附件";
      let url = process.env.VUE_APP_BASE_API + this.notifyDetail.answerFileUrl;
      let suffix = url.substring(url.lastIndexOf("."), url.length);
      const a = document.createElement('a')
      a.setAttribute('download', name + suffix)
      a.setAttribute('target', '_blank')
      a.setAttribute('href', url)
      a.click()
    },
    //关闭页面
    closePage() {
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped>
@import "./quill.core.css";
</style>

